package com.nanhai.buddhist.college.module.study.dal.mysql.attendanceleavereason;

import java.util.*;

import com.nanhai.buddhist.college.framework.common.pojo.PageResult;
import com.nanhai.buddhist.college.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.nanhai.buddhist.college.framework.mybatis.core.mapper.BaseMapperX;
import com.nanhai.buddhist.college.module.study.dal.dataobject.attendanceleavereason.AttendanceLeaveReasonDO;
import org.apache.ibatis.annotations.Mapper;
import com.nanhai.buddhist.college.module.study.controller.admin.attendanceleavereason.vo.*;

/**
 * 请假事由 Mapper
 *
 * @author Akai
 */
@Mapper
public interface AttendanceLeaveReasonMapper extends BaseMapperX<AttendanceLeaveReasonDO> {

    default PageResult<AttendanceLeaveReasonDO> selectPage(AttendanceLeaveReasonPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AttendanceLeaveReasonDO>()
                .eqIfPresent(AttendanceLeaveReasonDO::getLeaveReason, reqVO.getLeaveReason())
                .eqIfPresent(AttendanceLeaveReasonDO::getTeacherSubmitUser, reqVO.getTeacherSubmitUser())
                .eqIfPresent(AttendanceLeaveReasonDO::getStudentSubmitUser, reqVO.getStudentSubmitUser())
                .orderByDesc(AttendanceLeaveReasonDO::getCreateTime));
    }

    default List<AttendanceLeaveReasonDO> selectList(AttendanceLeaveReasonExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<AttendanceLeaveReasonDO>()
                .eqIfPresent(AttendanceLeaveReasonDO::getLeaveReason, reqVO.getLeaveReason())
                .eqIfPresent(AttendanceLeaveReasonDO::getTeacherSubmitUser, reqVO.getTeacherSubmitUser())
                .eqIfPresent(AttendanceLeaveReasonDO::getStudentSubmitUser, reqVO.getStudentSubmitUser())
                .orderByDesc(AttendanceLeaveReasonDO::getCreateTime));
    }

}
